package com.scrawler.util;


import java.lang.reflect.Type;
import java.util.Map;

import com.google.gson.reflect.TypeToken;

public abstract class ConstantUtils {
	
	/** url 正则匹配表达式*/
	public static final String URL_REGEXP_RULES = "^http://.*";
	/** sohu 文章url正则过滤表达式*/
	// public static final String URL_NEWS_REGEXP = "^http://\\w+?\\.sohu.com/(.+/)*n\\d+.shtml";
	public static final String URL_NEWS_REGEXP = "^http://.*.sohu.com/(.+/)*n\\d+.shtml";
	/** sohu 专题页url正则过滤表达式*/
	public static final String URL_SPECIAL_TOPIC_REGEXP = "^http://\\w+?\\.sohu.com/(.+/)*$";
	/** 换行符*/
	public static final String NEW_LINE = "\n"; 
	/** gbk 编码 */
	public static final String CHARSET_GBK =  "GBK";
	/** 项目配置文件名称 */
	public static final String CONFIG_FILE_PROJECT = "/config/config.properties";
	/** log4j配置文件名称*/
	public static final String CONFIG_FILE_LOG4J = "/config/log4j.properties";
	/**数据库连接池文件名称*/
	public static final String CONFIG_FILE_DB_PROXOOL = "/config/proxool.xml";
	public static final String CONFIG_FILE_TEST_DB_PROXOOL = "/config/test-proxool.xml";
	/**spring 配置文件名称*/
	public static final String CONFIG_FILE_SPRING = "/spring/application.xml";


	/** 测试数据输出路径*/
	/** key-value(String-float) 存储类型*/
	public static final Type  TYPE_STRING_FLOAT= new TypeToken<Map<String, Float>>(){}.getType();
	/** key-value(Integer-float) 存储类型*/
	public static final Type  TYPE_INTEGER_FLOAT= new TypeToken<Map<Integer, Float>>(){}.getType();
	public static final Type  TYPE_INTEGER_STRING= new TypeToken<Map<Integer, String>>(){}.getType();
	/** url tail string*/
	public static final String URL_TAIL_STRING = ".shtml";

	/** 链接标题文字数量,少于这个数的直接过滤*/
	public static final int CHINESE_NUMBER_FILTER = Integer.parseInt(LoadConfig.getInstance().lookUpValueByKey("filter_chinese_number"));
	
	/** 循环更新周期*/
	// public static final int LOOP_UPDATE_CYCLE = Integer.parseInt(LoadConfig.getInstance().lookUpValueByKey("loop_update_cycle"));
	/** 新闻图片数量上限,超过这个上限,新闻被过滤*/
	public static final  int NEWS_IMAGE_COUNT_LIMIT = 3;

	/** 毫秒/小时*/
	public static final long MILISECOND_HOURS_12 = 12*60*60*1000l;
	public static final long MILISECOND_HOURS_24 = 24*60*60*1000l;
}
